Using history of unaligned writes to cache data and avoid read-modify-writes in a non-volatile storage device

ABSTRACT

Systems, methods and/or devices are used to enable using history of unaligned writes to cache data and avoid read-modify-writes in a non-volatile storage device. In one aspect, the method includes (1) receiving a plurality of input/output (I/O) requests including read requests and write requests to be performed in a plurality of regions in a logical address space of a host, and (2) performing one or more operations for each region of the plurality of regions in the logical address space of the host, including (a) determining whether the region has a history of unaligned write requests during a predetermined time period, and (b) if so: (i) determining one or more sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period, and (ii) caching data from the determined one or more sub-regions.

RELATED APPLICATION

This application claims priority to U.S. Provisional Patent Application Ser. No. 62/005,966, filed May 30, 2014, entitled “Using History of Unaligned Writes to Cache Data and Avoid Read-Modify-Writes in a Non-Volatile Storage Device,” which is hereby incorporated by reference in its entirety.

TECHNICAL FIELD

The disclosed embodiments relate generally to memory systems, and in particular, to using history of unaligned writes to cache data and avoid read-modify-writes in a non-volatile storage device.

BACKGROUND

Semiconductor memory devices, including flash memory, typically utilize memory cells to store data as an electrical value, such as an electrical charge or voltage. A flash memory cell, for example, includes a single transistor with a floating gate that is used to store a charge representative of a data value. Flash memory is a non-volatile data storage device that can be electrically erased and reprogrammed. More generally, non-volatile memory (e.g., flash memory, as well as other types of non-volatile memory implemented using any of a variety of technologies) retains stored information even when not powered, as opposed to volatile memory, which requires power to maintain the stored information. Increases in storage density have been facilitated in various ways, including increasing the density of memory cells on a chip enabled by manufacturing developments, and transitioning from single-level flash memory cells to multi-level flash memory cells, so that two or more bits can be stored by each flash memory cell.

Since flash memory can only be programmed and erased a limited number of times, it is important to optimize memory management processes (e.g., garbage collection, wear leveling, caching, etc.) to enhance performance and endurance of memory devices.

SUMMARY

Various implementations of systems, methods and devices within the scope of the appended claims each have several aspects, no single one of which is solely responsible for the attributes described herein. Without limiting the scope of the appended claims, after considering this disclosure, and particularly after considering the section entitled “Detailed Description” one will understand how the aspects of various implementations are used to enable using history of unaligned writes to cache data and avoid read-modify-writes in a non-volatile storage device. In one aspect, in accordance with a determination that a region has a history of unaligned write requests during a predetermined time period, data from one or more sub-regions within the region are cached.

BRIEF DESCRIPTION OF THE DRAWINGS

So that the present disclosure can be understood in greater detail, a more particular description may be had by reference to the features of various implementations, some of which are illustrated in the appended drawings. The appended drawings, however, merely illustrate the more pertinent features of the present disclosure and are therefore not to be considered limiting, for the description may admit to other effective features.

FIG. 1 is a block diagram illustrating an implementation of a data storage system, in accordance with some embodiments.

FIG. 2A is a block diagram illustrating an implementation of a management module, in accordance with some embodiments.

FIG. 2B is a block diagram illustrating an implementation of a history table included in FIG. 2A, in accordance with some embodiments.

FIG. 3 is a block diagram of a plurality of regions in a logical address space of a host, in accordance with some embodiments.

FIG. 4 is a block diagram of a forward mapping table, physical address space, and bank data, in accordance with some embodiments.

FIG. 5 is a block diagram of a cache with a cached sub-region, in accordance with some embodiments.

FIGS. 6A-6D illustrate a flowchart representation of a memory management method, in accordance with some embodiments.

In accordance with common practice the various features illustrated in the drawings may not be drawn to scale. Accordingly, the dimensions of the various features may be arbitrarily expanded or reduced for clarity. In addition, some of the drawings may not depict all of the components of a given system, method or device. Finally, like reference numerals may be used to denote like features throughout the specification and figures.

DETAILED DESCRIPTION

The various implementations described herein include systems, methods and/or devices used to enable using history of unaligned writes to cache data and avoid read-modify-writes in a non-volatile storage device. Some implementations include systems, methods and/or devices to cache, in accordance with a determination that a region has a history of unaligned write requests during a predetermined time period, data from one or more sub-regions within the region.

More specifically, some embodiments include a method. In some embodiments, the method includes (1) receiving, at a storage device, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host, and (2) performing one or more operations for each region of the plurality of regions in the logical address space of the host, including (a) determining whether the region has a history of unaligned write requests during a predetermined time period, wherein unaligned write requests are write requests not aligned with predefined page boundaries, and (b) in accordance with a determination that the region has a history of unaligned write requests during the predetermined time period: (i) determining one or more sub-regions of a plurality of sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period, and (ii) caching, from a storage medium of the storage device to a cache of the storage device, data from the determined one or more sub-regions.

In some embodiments, caching data from the determined one or more sub-regions includes, in response to a subsequent write request to a respective sub-region of the determined one or more sub-regions, caching the respective sub-region.

In some embodiments, with respect to a region of the plurality of regions, determining whether the region has a history of unaligned write requests during the predetermined time period includes (1) tracking a total number of unaligned write requests to the region, and (2) determining whether the total number of unaligned write requests to the region is greater than a first threshold.

In some embodiments, the method further includes, with respect to a sub-region of the determined one or more sub-regions, subsequent to caching data from the sub-region, (1) writing subsequent write requests to the sub-region to the cache, (2) reading subsequent read requests from the sub-region from the cache, and (3) writing contents of the cache to the storage medium of the storage device in a merged operation.

In some embodiments, the method further includes, for each region of the plurality of regions in the logical address space, setting a flag to denote the determination of whether the region has a history of unaligned write requests during the predetermined time period.

In some embodiments, the method further includes, for each region of the plurality of regions in the logical address space, storing information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period.

In some embodiments, the predetermined time period is configurable.

In some embodiments, the predetermined threshold number is configurable.

In some embodiments, the storage device comprises one or more flash memory devices.

In some embodiments, the storage device comprises one or more three-dimensional (3D) memory devices and circuitry associated with operation of memory elements in the one or more 3D memory devices.

In some embodiments, the circuitry and one or more memory elements in a respective 3D memory device, of the one or more 3D memory devices, are on the same substrate.

In another aspect, any of the methods described above are performed by a storage device, the storage device including (1) one or more processors, and (2) memory storing one or more programs, which when executed by the one or more processors cause the storage device to perform or control performance of any of the methods described herein.

In yet another aspect, any of the methods described above are performed by a storage device including means for performing any of the methods described herein.

In yet another aspect, any of the methods described above are performed by a storage system comprising (1) a storage medium (e.g., comprising one or more non-volatile storage devices, such as flash memory devices) (2) one or more processors, and (3) memory storing one or more programs, which when executed by the one or more processors cause the storage system to perform or control performance of any of the methods described herein.

In yet another aspect, some embodiments include a non-transitory computer readable storage medium, storing one or more programs configured for execution by one or more processors of a storage device, the one or more programs including instructions for performing any of the methods described herein.

Numerous details are described herein in order to provide a thorough understanding of the example implementations illustrated in the accompanying drawings. However, some embodiments may be practiced without many of the specific details, and the scope of the claims is only limited by those features and aspects specifically recited in the claims. Furthermore, well-known methods, components, and circuits have not been described in exhaustive detail so as not to unnecessarily obscure more pertinent aspects of the implementations described herein.

FIG. 1 is a block diagram illustrating an implementation of data storage system 100, in accordance with some embodiments. While some example features are illustrated, various other features have not been illustrated for the sake of brevity and so as not to obscure more pertinent aspects of the example implementations disclosed herein. To that end, as a non-limiting example, data storage system 100 includes a storage device 120, which includes a storage controller 124 and a storage medium 130, and is used in conjunction with a computer system 110. In some implementations, storage medium 130 is a single flash memory device while in other implementations storage medium 130 includes a plurality of flash memory devices. In some implementations, storage medium 130 is NAND-type flash memory or NOR-type flash memory. In some implementations, storage medium 130 includes one or more three-dimensional (3D) memory devices, as further defined herein. Further, in some implementations storage controller 124 is a solid-state drive (SSD) controller. However, other types of storage media may be included in accordance with aspects of a wide variety of implementations.

Computer system 110 is coupled to storage controller 124 through data connections 101. However, in some implementations computer system 110 includes storage controller 124 as a component and/or a sub-system. Computer system 110 may be any suitable computer device, such as a computer, a laptop computer, a tablet device, a netbook, an internet kiosk, a personal digital assistant, a mobile phone, a smart phone, a gaming device, a computer server, or any other computing device. Computer system 110 is sometimes called a host or host system. In some implementations, computer system 110 includes one or more processors, one or more types of memory, a display and/or other user interface components such as a keyboard, a touch screen display, a mouse, a track-pad, a digital camera and/or any number of supplemental devices to add functionality.

Storage medium 130 is coupled to storage controller 124 through connections 103. Connections 103 are sometimes called data connections, but typically convey commands in addition to data, and optionally convey metadata, error correction information and/or other information in addition to data values to be stored in storage medium 130 and data values read from storage medium 130. In some implementations, however, storage controller 124 and storage medium 130 are included in the same device as components thereof. Furthermore, in some implementations storage controller 124 and storage medium 130 are embedded in a host device, such as a mobile device, tablet, other computer or computer controlled device, and the methods described herein are performed by the embedded memory controller. Storage medium 130 may include any number (i.e., one or more) of memory devices including, without limitation, non-volatile semiconductor memory devices, such as flash memory. For example, flash memory devices can be configured for enterprise storage suitable for applications such as cloud computing, or for caching data stored (or to be stored) in secondary storage, such as hard disk drives. Additionally and/or alternatively, flash memory can also be configured for relatively smaller-scale applications such as personal flash drives or hard-disk replacements for personal, laptop and tablet computers. In some embodiments, storage medium 130 includes one or more three-dimensional (3D) memory devices, as further defined herein.

Storage medium 130 is divided into a number of addressable and individually selectable blocks, such as selectable portion 131. In some implementations, the individually selectable blocks are the minimum size erasable units in a flash memory device. In other words, each block contains the minimum number of memory cells that can be erased simultaneously. Each block is usually further divided into a plurality of pages and/or word lines, where each page or word line is typically an instance of the smallest individually accessible (readable) portion in a block. In some implementations (e.g., using some types of flash memory), the smallest individually accessible unit of a data set, however, is a sector, which is a subunit of a page. That is, a block includes a plurality of pages, each page contains a plurality of sectors, and each sector is the minimum unit of data for reading data from the flash memory device.

For example, one block comprises any number of pages, for example, 64 pages, 128 pages, 256 pages or another suitable number of pages. Blocks are typically grouped into a plurality of zones. Each block zone can be independently managed to some extent, which increases the degree of parallelism for parallel operations and simplifies management of storage medium 130.

In some implementations, storage controller 124 includes a management module 121, a host interface 129, a storage medium interface (I/O) 128, and additional module(s) 125. Storage controller 124 may include various additional features that have not been illustrated for the sake of brevity and so as not to obscure more pertinent features of the example implementations disclosed herein, and a different arrangement of features may be possible. Host interface 129 provides an interface to computer system 110 through data connections 101. Similarly, storage medium I/O 128 provides an interface to storage medium 130 though connections 103. In some implementations, storage medium I/O 128 includes read and write circuitry, including circuitry capable of providing reading signals to storage medium 130 (e.g., reading threshold voltages for NAND-type flash memory).

In some implementations, management module 121 includes one or more processing units (CPUs, also sometimes called processors) 122 configured to execute instructions in one or more programs (e.g., in management module 121). In some implementations, the one or more CPUs 122 are shared by one or more components within, and in some cases, beyond the function of storage controller 124. Management module 121 is coupled to host interface 129, additional module(s) 125 and storage medium I/O 128 in order to coordinate the operation of these components.

Additional module(s) 125 are coupled to storage medium I/O 128, host interface 129, and management module 121. As an example, additional module(s) 125 may include an error control module to limit the number of uncorrectable errors inadvertently introduced into data during writes to memory or reads from memory. In some embodiments, additional module(s) 125 are executed in software by the one or more CPUs 122 of management module 121, and, in other embodiments, additional module(s) 125 are implemented in whole or in part using special purpose circuitry (e.g., to perform encoding and decoding functions).

During a write operation, host interface 129 receives data to be stored in storage medium 130 from computer system 110. The data held in host interface 129 is made available to an encoder (e.g., in additional module(s) 125), which encodes the data to produce one or more codewords. The one or more codewords are made available to storage medium I/O 128, which transfers the one or more codewords to storage medium 130 in a manner dependent on the type of storage medium being utilized.

A read operation is initiated when computer system (host) 110 sends one or more host read commands on control line 111 to storage controller 124 requesting data from storage medium 130. Storage controller 124 sends one or more read access commands to storage medium 130, via storage medium I/O 128, to obtain raw read data in accordance with memory locations (addresses) specified by the one or more host read commands. Storage medium I/O 128 provides the raw read data (e.g., comprising one or more codewords) to a decoder (e.g., in additional module(s) 125). If the decoding is successful, the decoded data is provided to host interface 129, where the decoded data is made available to computer system 110. In some implementations, if the decoding is not successful, storage controller 124 may resort to a number of remedial actions or provide an indication of an irresolvable error condition.

Flash memory devices utilize memory cells to store data as electrical values, such as electrical charges or voltages. Each flash memory cell typically includes a single transistor with a floating gate that is used to store a charge, which modifies the threshold voltage of the transistor (i.e., the voltage needed to turn the transistor on). The magnitude of the charge, and the corresponding threshold voltage the charge creates, is used to represent one or more data values. In some implementations, during a read operation, a reading threshold voltage is applied to the control gate of the transistor and the resulting sensed current or voltage is mapped to a data value.

The terms “cell voltage” and “memory cell voltage,” in the context of flash memory cells, means the threshold voltage of the memory cell, which is the minimum voltage that needs to be applied to the gate of the memory cell's transistor in order for the transistor to conduct current. Similarly, reading threshold voltages (sometimes also called reading signals, reading voltages, and/or read thresholds) applied to a flash memory cells are gate voltages applied to the gates of the flash memory cells to determine whether the memory cells conduct current at that gate voltage. In some implementations, when a flash memory cell's transistor conducts current at a given reading threshold voltage, indicating that the cell voltage is less than the reading threshold voltage, the raw data value for that read operation is a “1,” and otherwise the raw data value is a “0.”

As explained above, a storage medium (e.g., storage medium 130) is divided into a number of addressable and individually selectable blocks and each block is optionally (but typically) further divided into a plurality of pages and/or word lines and/or sectors. While erasure of a storage medium is performed on a block basis, in many embodiments, reading and programming of the storage medium is performed on a smaller subunit of a block (e.g., on a page basis, word line basis, or sector basis). In some embodiments, the smaller subunit of a block consists of multiple memory cells (e.g., single-level cells or multi-level cells). In some embodiments, programming is performed on an entire page. In some embodiments, a multi-level cell (MLC) NAND flash typically has four possible states per cell, yielding two bits of information per cell. Further, in some embodiments, a MLC NAND has two page types: (1) a lower page (sometimes called fast page), and (2) an upper page (sometimes called slow page).

As an example, if data is written to a storage medium in pages, but the storage medium is erased in blocks, pages in the storage medium may contain invalid (e.g., stale) data, but those pages cannot be overwritten until the whole block containing those pages is erased. In order to write to the pages with invalid data, the pages with valid data in that block are read and re-written to a new block and the old block is erased (or put on a queue for erasing). This process is called garbage collection. After garbage collection, the new block contains pages with valid data and free pages that are available for new data to be written, and the old block that was erased is also available for new data to be written. Since flash memory can only be programmed and erased a limited number of times, the efficiency of the algorithm used to pick the next block(s) to re-write and erase has a significant impact on the lifetime and reliability of flash-based storage systems.

Write amplification is a phenomenon where the actual amount of physical data written to a storage medium (e.g., storage medium 130) is a multiple of the logical amount of data intended to be written by a host (e.g., computer system 110, sometimes called a host). As discussed above, when a storage medium must be erased before it can be re-written, the garbage collection process to perform these operations results in re-writing data one or more times. This multiplying effect increases the number of writes required over the life of a storage medium, which shortens the time it can reliably operate. The formula to calculate the write amplification of a storage system is given by equation (1):

$\begin{matrix} \frac{{amount}\mspace{14mu}{of}\mspace{14mu}{data}\mspace{14mu}{written}\mspace{14mu}{to}\mspace{14mu} a\mspace{14mu}{storage}\mspace{14mu}{medium}}{{amount}\mspace{14mu}{of}\mspace{14mu}{data}\mspace{14mu}{written}\mspace{14mu}{by}\mspace{14mu} a\mspace{14mu}{host}} & (1) \end{matrix}$

One of the goals of any storage system architecture is to reduce write amplification as much as possible so that available endurance is used to meet storage medium reliability and warranty specifications. Higher system endurance also results in lower cost as the storage system may need less over-provisioning. By reducing the write amplification, the endurance of the storage medium is increased and the overall cost of the storage system is decreased. Generally, garbage collection is performed on erase blocks with the fewest number of valid pages for best performance and best write amplification.

FIG. 2A is a block diagram illustrating an exemplary management module 121, in accordance with some embodiments. Management module 121 typically includes one or more processing units (CPUs) 122 for executing modules, programs and/or instructions stored in memory 206 and thereby performing processing operations, memory 206, and one or more communication buses 208 for interconnecting these components. Communication buses 208 optionally include circuitry (sometimes called a chipset) that interconnects and controls communications between system components. Management module 121 is coupled to host interface 129, additional module(s) 125, and storage medium I/O 128 by communication buses 208. Memory 206 includes high-speed random access memory, such as DRAM, SRAM, DDR RAM or other random access solid state memory devices, and may include non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid state storage devices. Memory 206 optionally includes one or more storage devices remotely located from the CPU(s) 122. Memory 206, or alternately the non-volatile memory device(s) within memory 206, comprises a non-transitory computer readable storage medium. In some embodiments, memory 206, or the computer readable storage medium of memory 206 stores the following programs, modules, and data structures, or a subset thereof:

-   -   I/O receiving module 210 that is used for receiving from a host         a plurality of input/output (I/O) requests (e.g., read requests         and/or write requests to be performed in a plurality of regions         in a logical address space of the host);     -   translation table 212 that is used for mapping logical addresses         to physical addresses (e.g., in some embodiments, translation         table 212 includes forward mapping table 402, FIG. 4);     -   data read module 214 that is used for reading data from one or         more blocks in a storage medium;     -   data write module 216 that is used for writing data to one or         more blocks in a storage medium;     -   data erase module 218 that is used for erasing data from one or         more blocks in a storage medium;     -   garbage collection module 220 that is used for garbage         collection for one or more blocks in a storage medium;     -   history maintaining module 222 that is used for maintaining a         history of I/O request patterns (e.g., one or more histories of         I/O request patterns) in one or more regions of a plurality of         regions in a logical address space of a host;     -   history table 224 that includes a collection of data structures         (e.g., region data structures 244, FIG. 2B), each data structure         storing data for a respective region of a plurality of regions         in a logical address space of a host;     -   adjustment module 226 that is used for using the history of I/O         request patterns in a respective region to adjust subsequent I/O         processing in the respective region;     -   cache module 228 that is used for caching data from one or more         regions (or one or more sub-regions within the one or more         regions) of a plurality of regions in a logical address space of         a host (e.g., from a storage medium of a storage device to a         cache of the storage device); and     -   region module 230 that is used for performing one or more         operations for each region of the plurality of regions in the         logical address space of the host, optionally including:         -   determining module 232 that is used for determining whether             the region has a history of unaligned write requests (e.g.,             write requests not aligned with predefined page boundaries)             during a predetermined time period; and         -   sub-region module 234 that is used for performing one or             more operations for each sub-region of a plurality of             sub-regions, from a respective region (e.g., determining one             or more sub-regions of a plurality of sub-regions, from a             respective region, that are accessed more than a             predetermined threshold number of times during the             predetermined time period).

Each of the above identified elements may be stored in one or more of the previously mentioned memory devices, and corresponds to a set of instructions for performing a function described above. The above identified modules or programs (i.e., sets of instructions) need not be implemented as separate software programs, procedures or modules, and thus various subsets of these modules may be combined or otherwise re-arranged in various embodiments. In some embodiments, memory 206 may store a subset of the modules and data structures identified above. Furthermore, memory 206 may store additional modules and data structures not described above. In some embodiments, the programs, modules, and data structures stored in memory 206, or the computer readable storage medium of memory 206, provide instructions for implementing any of the methods described below with reference to FIGS. 6A-6D.

Although FIG. 2A shows management module 121 in accordance with some embodiments, FIG. 2A is intended more as a functional description of the various features which may be present in management module 121 than as a structural schematic of the embodiments described herein. In practice, and as recognized by those of ordinary skill in the art, items shown separately could be combined and some items could be separated.

FIG. 2B is a block diagram illustrating an implementation of a history table 224 included in FIG. 2A, in accordance with some embodiments. History table 224 includes a collection of region data structures 244, that each store data associated with a respective region of a plurality of regions in a logical address space of a host (e.g., a respective region 310-i of a plurality of regions in a logical address space, FIG. 3). An example of a logical address space of a host is described in further detail below with respect to FIG. 3. In some embodiments, the data stored in region data structures 244 includes information regarding real-time history of I/O request patterns per region, for each region of a plurality of regions in a logical address space. For example, without limitation, in some embodiments in which a logical address space of a host (e.g., computer system 110, FIG. 1) includes a plurality of regions (e.g., region 310-1 through region 310-m, FIG. 3), history table 224 includes at least one region data structure for each region (e.g., region data structure 244-1 for region 310-1, region data structure 244-2 for region 310-2, etc.). In some embodiments, a history of I/O request patterns is maintained for only the regions that have some I/O activity during a predetermined time period. In some embodiments, a history of I/O request patterns is maintained for a subset of all the regions in a logical address space of a host. In some embodiments, a history of I/O request patterns is maintained for all of the regions in a logical address space of a host. In some embodiments, history table 224 is maintained in one or more data structures stored on a storage device (e.g., storage device 120, FIG. 1). In some embodiments, the storage device gathers data as I/O requests are processed and stores the history of I/O request patterns and/or determinations based on the history of I/O request patterns in history table 224. In some embodiments, history table 224 is maintained in one or more data structures stored on a host (e.g., computer system 110, FIG. 1). In some embodiments, the host gathers data as I/O requests are processed and stores the history of I/O request patterns and/or determinations based on the history of I/O request patterns in history table 224. In some embodiments, one or more operations performed to gather data and/or make determinations based on the data are performed at a host (e.g., computer system 110, FIG. 1), and relevant information is transmitted to a storage device (e.g., storage device 120, FIG. 1).

In some embodiments, each region data structure (e.g., region data structure 244-i) includes information regarding real-time history of I/O request patterns for a respective region, sometimes herein called a logical address region. For example, in some embodiments, region data structure 244-1 includes information regarding real-time history of I/O request patterns for region 1 of a plurality of regions, region data structure 244-2 includes information regarding real-time history of I/O request patterns for Region 2 of the plurality of regions, and so on. In some embodiments, the history of I/O request patterns is maintained for each region for a predetermined time period (e.g., one hour). In some embodiments, the predetermined time period is configurable. In some embodiments, after the predetermined time period, the history of I/O request patterns is reset (e.g., cleared). In some embodiments, one or more parameters of region data structure 244-i are not reset until a later time. In some embodiments, some parameters of a data structure (e.g., region data structure 244-i) are reset (e.g., cleared) after the predetermined time period, while other parameters of the data structure are not reset until a later time. For example, in some embodiments, parameters tracking various count values (e.g., sequential read count 250, sequential write count 252, small write count 254, unaligned write count 256 and/or large write count 258) are reset after the predetermined time period, but if the respective region still meets certain criteria (e.g., if the respective region is still a hot region), other parameters of the data structure are not reset until a later time (e.g., hot region flag 264, FIG. 2B, is not reset until the region is no longer hot).

Region data structure 244-i illustrates an implementation of a region data structure for a respective region (e.g., region i), in accordance with some embodiments. In some embodiments, region data structure 244-i stores the following data (sometimes called history of I/O requests for a particular time period, for a particular region of the logical address space), or a subset or superset thereof:

-   -   lowest LBA accessed 246 that is used for tracking a lowest         logical block address (LBA) accessed in the region;     -   highest LBA accessed 248 that is used for tracking a highest         logical block address (LBA) accessed in the region;     -   sequential read count 250 that is used for tracking a total         number of sequential read requests from the region;     -   sequential write count 252 that is used for tracking a total         number of sequential write requests to the region;     -   small write count 254 that is used for tracking a total number         of write requests to write data of size less than a predefined         small-size threshold;     -   unaligned write count 256 that is used for tracking a total         number of unaligned write requests to the region, wherein         unaligned write requests are write requests not aligned with         predefined page boundaries;     -   large write count 258 that is used for tracking a total number         of write requests to write data of size greater than a         predefined large-size threshold;     -   flags 260 that are used for tracking one or more determinations         based on the history of I/O request patterns, including in some         embodiments, one or more of:         -   sequential region flag 262 that is used for tracking whether             a total number of sequential I/O requests to the region has             exceeded a sequential request threshold;         -   hot region flag 264 that is used for tracking whether a             total number of write requests to the region has exceeded a             write threshold;         -   valid region flag 266 that is used for tracking whether the             region is accessed at least once by a plurality of I/O             requests;         -   optionally, one or more additional flags, each for tracking             a corresponding determination based on the history of I/O             request patterns;     -   time stamp 268 that is used for recording a time stamp         corresponding to when the history of I/O request patterns is         reset; and     -   sub-region counters 270 that are used for tracking a total         number of times each sub-region (of a plurality of sub-regions         in the region) is accessed.

FIG. 3 is a block diagram of a plurality of regions in a logical address space of a host, in accordance with some embodiments. In some embodiments, a logical address is the address at which an item (e.g., data stored on a memory cell) resides from the perspective of a host (e.g., computer system 110, FIG. 1). In some embodiments, a logical address differs from a physical address due to the operation of a mapping function or address translator (e.g., translation table 212, FIG. 2A, including forward mapping table 402, FIG. 4). In some embodiments, a logical block address (LBA) is mapped to a physical flash address (e.g., a physical page number (PPN), including a bank, block, and page), as described further with respect to FIG. 4.

In some embodiments, a logical address space includes a plurality of regions (e.g., region 310-1 through region 310-m), and each region includes a plurality of sub-regions (e.g., sub-region 312-1 through sub-region 312-n). In some embodiments, for example, if a storage device with an advertised capacity of 1 terabyte (TB) is divided into m regions, each region will be (1 TB)/m in size (e.g., if m=1024, each region will be (1 TB)/1024=1 gigabyte (GB) in size), and if each region is divided into n sub-regions, each sub-region will be ((1 TB)/m)/n in size (e.g., if m=1024 and n=1024, each sub-region will be ((1 TB)/1024)/1024=1 megabyte (MB) in size).

As described above with respect to FIG. 2B, in some embodiments, real-time history of I/O request patterns for a respective region is maintained for a plurality of regions in the logical address space. In some embodiments, the real-time history of I/O request patterns for a respective region (e.g., region i) is maintained in a region data structure (e.g., region data structure 244-i, FIG. 2B), which stores data corresponding to the history of I/O request patterns for the region and/or data corresponding to determinations made in accordance with the history of I/O request patterns for the region. For example, in some embodiments, real-time history of I/O request patterns for region 310-1 is maintained (e.g., in region data structure 244-1, FIG. 2B), and if a total number of write requests to region 310-1 has exceeded a write threshold during a predetermined time period, region 310-1 is marked with a hot region indicator (e.g., using hot region flag 264, FIG. 2B).

FIG. 4 is a block diagram of a forward mapping table 402, physical address space 410, and bank data 430, in accordance with some embodiments. In some embodiments, forward mapping table 402 is used to translate a logical block address (LBA) from the perspective of a host (e.g., computer system 110, FIG. 1) to a physical address in a physical address space (e.g., physical address space 410) of a storage device (e.g., storage device 120, FIG. 1). In some embodiments, an LBA is the smallest unit that is accessible by a host (e.g., 512 B). In some embodiments, LBAs are organized in numerical order in the logical address space. Using the example from FIG. 3, in some embodiments, where the logical address space includes a plurality of regions and each region is 1 GB in size, the LBAs in the first 1 GB of the logical address space are in a first region (e.g., region 310-1, FIG. 3), the LBAs in the second 1 GB of the logical address space are in a second region (e.g., region 310-2, FIG. 3), and so on.

In some embodiments, forward mapping table 402 is stored in memory associated with the storage device (e.g., in memory 206, as part of translation table 212, FIG. 2A). In some embodiments, a physical address is a physical page number (PPN), including a bank number, a block number, and a page number. In the example shown in FIG. 4, LBA 0 is mapped to bank 1 (e.g., Bank 420-1), block 3 (e.g., Block 421-3), page 37 (pages not shown in FIG. 4) of physical address space 410.

In some embodiments, bank data 430 includes information for each bank of physical address space 410 (e.g., bank 420-1 through 420-q). For example, in some embodiments, for bank i (e.g., bank 420-i), bank data 430 includes a queue of available blocks in bank i (e.g., for which to write data), a pointer to an active block in bank i (e.g., a block to which data from write requests is written), and a pointer to an active hot block in bank i (e.g., a block to which data from write requests to hot regions is written). For example, if a region (e.g., region 310-1, FIG. 3) is marked with a hot region indicator (e.g., using hot region flag 264, FIG. 2B), in some embodiments, subsequent write requests to that region are written to an active hot block. Conversely, if a region (e.g., region 310-1, FIG. 3) is not marked with a hot region indicator, in some embodiments, subsequent write requests to that region are written to an active block (sometimes referred to as an active “cold block,” as opposed to an active hot block). Depending on how LBAs are mapped to banks in forward mapping table 402, each bank in physical address space 410 may need to store data specified by a write request to a region marked with a hot region indicator (sometimes referred to as a “hot region”) and/or store data specified by a write request to a region not marked with a hot region indicator (sometimes referred to as a “cold region”). In some embodiments, if an LBA for a write request is from a hot region, the data specified by the write request is stored on the active hot block, and if the LBA for a write request is from a cold region, the data specified by the write request is stored on the active block (e.g., a cold block that is active). In this manner, data associated with hot regions are grouped together (e.g., on hot blocks) and data associated with cold regions are grouped together (e.g., on cold blocks).

Typically, data in hot regions are invalidated faster than data in cold regions, due to a higher frequency of updates to data in the hot regions than updates to data in the cold regions. For example, if certain popular files are accessed and edited frequently (e.g., if a user frequently accesses and edits certain documents), in some embodiments, the region of the logical address space in which those popular files reside are marked with a hot region indicator, if the region is accessed more than a predetermined threshold during a predefined period of time. In some embodiments, the LBAs of the hot region are mapped to blocks (and pages) in the physical address space (e.g., physical address space 410) of the storage device (e.g., storage device 120, FIG. 1) using a translation table (e.g., forward mapping table 402), and the open blocks associated with the hot region are marked with a hot block indicator. In some embodiments, for each bank of physical address space 410, bank data 430 includes a queue of hot blocks available for writing, with a pointer to the active hot block for storing data from write requests to a hot region. In some embodiments, for each bank of physical address space 410, bank data 430 includes a queue of cold blocks available for writing, with a pointer to the active cold block for storing data from write requests to a cold region. Since hot regions, by definition, are written to more frequently than cold regions, pages in the hot blocks are typically invalidated faster (i.e., more frequently, on average) than pages in the cold blocks. By grouping together data associated with hot regions in the hot blocks, hot blocks will typically have more invalid pages due to the frequent updating of data in the hot regions, resulting in fewer valid pages that need to be copied in a garbage collection operation. By grouping together data from cold regions in the cold blocks, cold blocks will typically have more valid pages, due to the lower frequency of updates in the cold regions than the hot regions, and will be less likely to be selected for garbage collection, reducing the movement of cold data to new blocks. This localization of writes from hot regions to hot blocks and localization of writes from cold regions to cold blocks reduces the number of blocks that require garbage collection and reduces the number of valid pages that need to be copied during garbage collection, thus reducing write amplification and improving endurance of the storage device.

Although the description herein uses examples in which regions are separated into two categories (e.g., hot or cold) and blocks are separated into two categories accordingly, those skilled in the art will appreciate that the embodiments described herein may be extended to more than two categories (e.g., three categories for regions and associated blocks, including hot, warm, and cold).

FIG. 5 is a block diagram of a cache 500 with a cached sub-region 510, in accordance with some embodiments. In some embodiments, cache 500 is included in a storage device (e.g., storage device 120, FIG. 1). In some embodiments, cache 500 is implemented in one or more volatile random access memory devices, such as, without limitation, DRAM or SRAM devices. In some embodiments, cache 500 is physically external to a storage device (e.g., external to storage device 120, FIG. 1). For example, in some embodiments, cache 500 is located in a DRAM device external to the storage device, where the DRAM device may be sized differently for different customers. In some other embodiments, cache 500 is physically part of the storage device.

In some embodiments, sub-regions that meet predefined criteria (e.g., sub-regions that are accessed more than a predetermined threshold number of times and/or sub-regions that have a history of unaligned write requests) are cached to cache 500. For example, in some embodiments, if a region (e.g., region 310-2, FIG. 3) has a history of unaligned write requests (e.g., determined from unaligned write count 256, FIG. 2B), where unaligned write requests are write requests not aligned with predefined page boundaries, a sub-region in that region (e.g., sub-region 312-3, FIG. 3) that is accessed more than a predetermined threshold number of times is cached to cache 500. In some embodiments, the predefined page boundaries are defined with respect to the logical address space of the host. In one example, in which L logical blocks (e.g., 8 blocks) are mapped to each physical page in storage medium 130, the predefined page boundaries are the logical addresses of the first (or last) location in each set of L logical blocks. Restated, in this example, the predefined page boundaries are logical addresses in the logical address space that are positive integer multiples of L*B, where B is the size of one logical block and L is the number of logical blocks mapped to each physical page in storage medium 130. In a more specific example, the predefined page boundaries are logical addresses that are positive integer multiples of 4 KB (i.e., 4098 bytes).

I/O alignment refers to whether the starting address of an I/O request is a multiple of the smallest unit size of a storage medium (e.g., aligned with a 4 KB page of a NAND flash memory device). For every misaligned write, the storage device must perform at least one read-modify-write operation on data stored in non-volatile memory. For example, an unaligned write request spanning pages 0 through 2 (depicted by the dotted box in cached sub-region 510) normally requires two read-modify-write operations on data stored in non-volatile memory, since the unaligned write request is only modifying a portion of page 0 and a portion of page 2. In some embodiments, since a program (e.g., write) operation is performed on an entire (erased) page, the storage device first reads page 0 to determine the portion of data that is not modified, modifies the portion of data that is affected by the unaligned write request, writes the data to a new page location, and invalidates page 0. A similar process is needed for page 2. However, in some embodiments, if sub-region 510 is cached, unaligned writes are processed in the cache, and may then be written to a storage medium (e.g., storage medium 130, FIG. 1) in a merged operation, thus reducing or avoiding read-modify-write operations on data stored in non-volatile memory.

FIGS. 6A-6D illustrate a flowchart representation of a memory management method 600, in accordance with some embodiments. At least in some embodiments, method 600 is performed by a storage device (e.g., storage device 120, FIG. 1) or one or more components of the storage device (e.g., storage controller 124 and/or storage medium 130, FIG. 1), wherein the storage device is operatively coupled with a host system (e.g., computer system 110, FIG. 1). In some embodiments, method 600 is governed by instructions that are stored in a non-transitory computer readable storage medium and that are executed by one or more processors of a device, such as the one or more processing units (CPUs) 122 of management module 121, shown in FIGS. 1 and 2A. In some embodiments, method 600 is performed by a storage system (e.g., data storage system 100, FIG. 1) or one or more components of the storage system (e.g., computer system 110 and/or storage device 120, FIG. 1). In some embodiments, some of the operations of method 600 are performed at a host (e.g., computer system 110, FIG. 1) and information is transmitted to a storage device (e.g., storage device 120, FIG. 1). In some embodiments, method 600 is governed, at least in part, by instructions that are stored in a non-transitory computer readable storage medium and that are executed by one or more processors of a host (not shown in FIG. 1). For ease of explanation, the following describes method 600 as performed by a storage device (e.g., storage device 120, FIG. 1). However, those skilled in the art will appreciate that in other embodiments, one or more of the operations described in method 600 are performed by a host (e.g., computer system 110, FIG. 1).

A storage device (e.g., storage device 120, FIG. 1) receives (602) a plurality of input/output (I/O) requests from a host (e.g., computer system 110, FIG. 1), the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host. In some embodiments, the I/O requests specify operations (sometimes called storage operations or memory operations) to be performed with respect to logical addresses in a plurality of regions in a logical address space of a host (e.g., regions 310, FIG. 3). In some embodiments, the plurality of I/O requests includes read requests from one or more regions of the plurality of regions and write requests to one or more regions of the plurality of regions. For example, in some embodiments, the plurality of I/O requests includes one or more read requests from one or more regions of the plurality of regions (e.g., regions 310, FIG. 3) and one or more write requests to one or more regions of the plurality of regions. In some embodiments, an I/O receiving module (e.g., I/O receiving module 210, FIG. 2A) is used to receive a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host, as described above with respect to FIG. 2A.

In some embodiments, the storage device comprises (604) one or more flash memory devices. In some embodiments, the storage device comprises a storage medium (e.g., storage medium 130, FIG. 1), and the storage medium comprises one or more non-volatile storage devices, such as flash memory devices. In some embodiments, the storage medium (e.g., storage medium 130, FIG. 1) is a single flash memory device, while in other embodiments the storage medium includes a plurality of flash memory devices. For example, in some implementations, the storage medium includes dozens or hundreds of flash memory devices, organized in parallel memory channels, such as 16, 32 or 64 flash memory devices per memory channel, and 8, 16 or 32 parallel memory channels. In some embodiments, the non-volatile storage medium (e.g., storage medium 130, FIG. 1) includes NAND-type flash memory or NOR-type flash memory. In other embodiments, the storage medium comprises one or more other types of non-volatile storage devices.

In some embodiments, the storage device comprises (606) one or more three-dimensional (3D) memory devices, as further defined herein, and circuitry associated with operation of memory elements in the one or more 3D memory devices. In some embodiments, the storage device comprises a storage medium (e.g., storage medium 130, FIG. 1), and the storage medium comprises one or more 3D memory devices and circuitry associated with operation of memory elements in the one or more 3D memory devices. In some embodiments, the storage medium (e.g., storage medium 130, FIG. 1) is a single 3D memory device, while in other embodiments the storage medium includes a plurality of 3D memory devices.

In some embodiments, the circuitry and one or more memory elements in a respective 3D memory device, of the one or more 3D memory devices, are (608) on the same substrate (e.g., a silicon substrate). In some embodiments, the substrate is a wafer on which the material layers of the one or more memory elements are deposited and/or in which the one or more memory elements are formed. In some embodiments, the substrate is a carrier substrate which is attached to the one or more memory elements after they are formed. As a non-limiting example, in some embodiments, the substrate includes a semiconductor such as silicon.

The storage device performs (610) one or more operations for each region of the plurality of regions in the logical address space of the host, including: (1) determining (612) whether the region has a history of unaligned write requests during a predetermined time period, wherein unaligned write requests are write requests not aligned with predefined page boundaries, and (2) in accordance with a determination that the region has a history of unaligned write requests during the predetermined time period (614): (a) determining one or more sub-regions of a plurality of sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period, and (b) caching, from a storage medium of the storage device to a cache of the storage device, data from the determined one or more sub-regions. In some embodiments, the plurality of regions includes only regions that have some I/O activity during a predetermined time period. For example, in some embodiments, the one or more operations are performed only for regions that have I/O activity during a predetermined time period. Thus, in some embodiments, the plurality of regions is a subset of all the regions in the logical address space. For example, in some embodiments, the one or more operations are performed for a subset of all the regions in the logical address space (e.g., when only a subset of all the regions in the logical address space has I/O activity during the predetermined time period). In some embodiments, the plurality of regions is all of the regions in the logical address space, and thus in these embodiments the one or more operations are performed for all of the regions in the logical address space.

In some embodiments, a region module (e.g., region module 230, FIG. 2A), including an optional determining module (e.g., determining module 232, FIG. 2A) and/or an optional sub-region module (e.g., sub-region module 234, FIG. 2A), and/or a cache module (e.g., cache module 228, FIG. 2A) are used to perform one or more operations for each region of the plurality of regions in the logical address space of the host, including: (1) determining whether the region has a history of unaligned write requests during a predetermined time period, wherein unaligned write requests are write requests not aligned with predefined page boundaries, and (2) in accordance with a determination that the region has a history of unaligned write requests during the predetermined time period: (a) determining one or more sub-regions of a plurality of sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period, and (b) caching, from a storage medium of the storage device to a cache of the storage device, data from the determined one or more sub-regions, as described above with respect to FIG. 2A.

In some embodiments, some (e.g., one, some, or all) of the operations performed for each region of the plurality of regions in the logical address space of the host are performed at the storage device (e.g., storage device 120, FIG. 1). In some embodiments, some (e.g., one, some, or all) of the operations performed for each region of the plurality of regions in the logical address space of the host are performed at the host (e.g., computer system 110, FIG. 1). In some embodiments, one or more of the operations are performed at the storage device (e.g., storage device 120, FIG. 1) and one or more of the operations are performed at the host (e.g., computer system 110, FIG. 1). For ease of explanation, the description herein describes embodiments wherein the one or more operations are performed at the storage device. However, in some embodiments, one or more of the operations are performed at the host and signals and/or commands are transmitted to the storage device as needed. For example, in some embodiments, maintaining a history of I/O request patterns in the region for a predetermined time period and/or making determinations based on the history of I/O request patterns (e.g., determining whether a region has a history of unaligned write requests during a predetermined time period) is performed at the host and one or more signals (e.g., a command, a flag, etc.) is transmitted by the host to the storage device to either adjust subsequent I/O processing in the region or to communicate to the storage device one or more aspects of the history of I/O request patterns in the region.

As noted above, the storage device determines (612) whether the region has a history of unaligned write requests during a predetermined time period, wherein unaligned write requests are write requests not aligned with predefined page boundaries. In some embodiments, determining whether the region has a history of unaligned write requests during a predetermined time period is based on information (e.g., data gathered regarding I/O requests for the region) stored in a data structure (e.g., region data structure 244-i, FIG. 2B) for maintaining a history of I/O request patterns in the region for the predetermined time period. In some embodiments, a determining module (determining module 232, FIG. 2A) is used to determine whether the region has a history of unaligned write requests during a predetermined time period, wherein unaligned write requests are write requests not aligned with predefined page boundaries, as described above with respect to FIG. 2A.

In some embodiments, with respect to a region of the plurality of regions, determining whether the region has a history of unaligned write requests during the predetermined time period includes (616): (1) tracking a total number of unaligned write requests to the region, and (2) determining whether the total number of unaligned write requests to the region is greater than a first threshold. In some embodiments, tracking a total number of unaligned write requests to the region includes recording updated values for the total number of unaligned write requests to the region. For example, in some embodiments, tracking a total number of unaligned write requests to region 310-1 (FIG. 3) includes recording updated values for the total number of unaligned write requests to region 310-1 (e.g., in region data structure 244-1, FIG. 2B). In some embodiments, the total number of unaligned write requests is tracked and/or recorded using a parameter stored in a data structure (e.g., using unaligned write count 256 in region data structure 244-i, FIG. 2B). In some embodiments, a determination of whether the total number of unaligned write requests to the region is greater than a first threshold is tracked and/or recorded using a parameter stored in a data structure (e.g., using one of flags 260 in region data structure 244-i, FIG. 2B).

In some embodiments, the first threshold is configurable. For example, in some embodiments, the first threshold is configurable during initialization of the storage device (e.g., storage device 120, FIG. 1). As another example, in some embodiments, the first threshold is configurable during each power cycle of the storage device. In some embodiments, the first threshold is configurable using a configuration parameter, for example a configuration parameter specified by a command sent by a host system (e.g., computer system 110, FIG. 1). In some embodiments, the first threshold is configured to be a fixed number.

In some embodiments, the predetermined time period is (618) configurable. For example, in some embodiments, the predetermined time period is configurable during initialization of the storage device (e.g., storage device 120, FIG. 1). As another example, in some embodiments, the predetermined time period is configurable during each power cycle of the storage device. In some embodiments, the predetermined time period is configurable using a configuration parameter, for example a configuration parameter specified by a command sent by a host system (e.g., computer system 110, FIG. 1). In some embodiments, the predetermined time period is configured to be a fixed number.

In some embodiments, the predetermined time period is configured based on how long the history of I/O request patterns is to be maintained before resetting (e.g., clearing) the history (e.g., in region data structure 244-i, FIG. 2B). In some embodiments, some parameters of a data structure (e.g., region data structure 244-i, FIG. 2B) are reset (e.g., cleared) after the predetermined time period, while other parameters of the data structure are not reset until a later time. For example, in some embodiments, flags 260 are re-evaluated and set accordingly at the end of each predetermined time period based on the count values at the end of the predetermined time period, and parameters tracking various count values (e.g., sequential read count 250, sequential write count 252, small write count 254, unaligned write count 256 and/or large write count 258, FIG. 2B) are reset after the predetermined time period. Thus, if (i.e., in accordance with a determination that) the respective region still meets certain criteria (e.g., if the respective region is still a hot region), one or more other parameters (e.g., one or more respective flags 260) of the data structure are not reset until a later time (e.g., hot region flag 264, FIG. 2B, is not reset until the region is no longer hot). As a result, the respective time period used to determine whether to adjust a particular type of I/O operation may encompass both the prior predetermined time period (e.g., a one hour time period preceding the current one hour time period) and the current predetermined time period.

As noted above, the storage device, in accordance with a determination that the region has a history of unaligned write requests during the predetermined time period (614): (1) determines one or more sub-regions of a plurality of sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period, and (2) caches, from a storage medium (e.g., storage medium 130, FIG. 1) of the storage device to a cache (e.g., cache 500, FIG. 5) of the storage device, data from the determined one or more sub-regions. In some embodiments, the storage device caches data from the determined one or more sub-regions for the remainder of the predetermined time period. In some embodiments, the storage device also caches data from the determined one or more sub-regions for a next instance of the predetermined time period. In some embodiments, the storage device caches a predefined amount of data, such as all the pages on a word line, from the storage medium of the storage device. In some embodiments, the storage device caches an entire sub-region (e.g., one of the determined one or more sub-regions). For example, in some embodiments, the storage device, in accordance with a determination that region 310-2 (FIG. 3) has a history of unaligned write requests during the predetermined time period, (1) determines sub-region 312-3 (FIG. 3) is accessed more than a predetermined threshold number of times during the predetermined time period, and (2) caches, from a storage medium (e.g., storage medium 130, FIG. 1) of the storage device to a cache (e.g., cache 500, FIG. 5) of the storage device, data from sub-region 312-3 (e.g., stored as cached sub-region 510, FIG. 5). In a further example, the cached data is retained in the cache until occurrence of a trigger condition, such as the cached data being evicted from the cache due to normal cache maintenance operations. In another example, the trigger condition is a determination that the aforementioned conditions for caching the data no longer exist, which may be determined, for example, at the end or beginning of a respective predetermined time period. In some embodiments, a sub-region module (e.g., sub-region module 234, FIG. 2A) and/or a cache module (e.g., cache module 228, FIG. 2A) are used to, in accordance with a determination that the region has a history of unaligned write requests during the predetermined time period, (1) determine one or more sub-regions of a plurality of sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period, and (2) cache, from a storage medium of the storage device to a cache of the storage device, data from the determined one or more sub-regions, as described above with respect to FIG. 2A.

In some embodiments, the predetermined threshold number is (620) configurable. For example, in some embodiments, the predetermined threshold number is configurable during initialization of the storage device (e.g., storage device 120, FIG. 1). As another example, in some embodiments, the predetermined threshold number is configurable during each power cycle of the storage device. In some embodiments, the predetermined threshold number is configurable using a configuration parameter, for example a configuration parameter specified by a command sent by a host system (e.g., computer system 110, FIG. 1). In some embodiments, the predetermined threshold number is configured to be a fixed number.

In some embodiments, caching data from the determined one or more sub-regions includes (622), in response to a subsequent write request to a respective sub-region of the determined one or more sub-regions, caching the respective sub-region. For example, in some embodiments, when the determined one or more sub-regions includes sub-region 312-3 (FIG. 3), the storage device, in response to a subsequent write request to sub-region 312-3, caches sub-region 312-3 (e.g., stored as cached sub-region 510, FIG. 5). In some embodiments, the storage device caches the respective sub-region for the remainder of the predetermined time period. In some embodiments, the storage device also caches the respective sub-region for a next instance of the predetermined time period. In one example, the cached sub-region is retained in the cache until occurrence of a trigger condition, such as the cached sub-region being evicted from the cache due to normal cache maintenance operations. In another example, the trigger condition is a determination that the aforementioned conditions for caching the respective sub-region no longer exist, which may be determined, for example, at the end or beginning of a respective predetermined time period.

In some embodiments, with respect to a sub-region of the determined one or more sub-regions, subsequent to caching data from the sub-region (624), the storage device (1) writes subsequent write requests to the sub-region to the cache, (2) reads subsequent read requests from the sub-region from the cache, and (3) writes contents of the cache to the storage medium of the storage device in a merged operation. Using the example above where sub-region 312-3 (FIG. 3) is cached to cache 500 (FIG. 5) (e.g., stored as cached sub-region 510, FIG. 5), in some embodiments, subsequent to caching data from sub-region 312-3, the storage device (1) writes subsequent write requests to sub-region 312-3 to cache 500 (e.g., writes one or more pages to cached sub-region 510, FIG. 5), (2) reads subsequent read requests from sub-region 312-3 from cache 500 (e.g., reads one or more pages from cached sub-region 510, FIG. 5), and (3) writes contents of cache 500 (e.g., cached sub-region 510, FIG. 5) to the storage medium (e.g., storage medium 130, FIG. 1) of the storage device in a merged operation. In a further example, the writing of the contents of the cache to the storage medium occurs upon occurrence of a trigger condition, such as the contents of the cache being evicted from the cache due to normal cache maintenance operations. In another example, the trigger condition is a determination that the aforementioned conditions for caching data from the sub-region no longer exist, which may be determined, for example, at the end or beginning of a respective predetermined time period. In some embodiments, a sub-region module (e.g., sub-region module 234, FIG. 2A) and/or a data write module (e.g., data write module 216, FIG. 2A) are used to, with respect to a sub-region of the determined one or more sub-regions, subsequent to caching data from the sub-region, (1) write subsequent write requests to the sub-region to the cache, (2) read subsequent read requests from the sub-region from the cache, and (3) write contents of the cache to the storage medium of the storage device in a merged operation, as described above with respect to FIG. 2A.

In some embodiments, for each region of the plurality of regions in the logical address space of the host, the storage device sets (626) a flag to denote the determination of whether the region has a history of unaligned write requests during the predetermined time period. In some embodiments, setting a flag to denote the determination of whether the region has a history of unaligned write requests during the predetermined time period includes storing a flag (e.g., one of flags 260, FIG. 2B) or other marker for the region. In some embodiments, setting a flag to denote the determination of whether the region has a history of unaligned write requests during the predetermined time period includes setting the flag to “true” or “1” (as opposed to “false” or “0”) in accordance with a determination that the region has a history of unaligned write requests during the predetermined time period. For example, in some embodiments, in accordance with a determination that region 310-1 (FIG. 3) has a history of unaligned write requests during the predetermined time period, the storage device sets a flag (e.g., one of flags 260, FIG. 2B) to “1” in the region data structure associated with region 310-1 (e.g., region data structure 244-1, FIG. 2B). In some embodiments, the flag to denote the determination of whether the region has a history of unaligned write requests during the predetermined time period is set for the remainder of the predetermined time period. In some embodiments, the flag to denote the determination of whether the region has a history of unaligned write requests during the predetermined time period remains set for a next instance of the predetermined time period. In some embodiments, a region module (e.g., region module 230, FIG. 2A) is used to set, for each region of the plurality of regions in the logical address space of the host, a flag to denote the determination of whether the region has a history of unaligned write requests during the predetermined time period, as described above with respect to FIG. 2A.

As discussed above, in some embodiments, flags (e.g., flags 260, FIG. 2B) are re-evaluated and set accordingly at the end of each predetermined time period based on the count values at the end of the predetermined time period. As a result, in some embodiments, flags are set based on the history of I/O requests in the current predetermined time period and/or based on the history of I/O requests in the prior predetermined time period. In one example that uses one hour time periods as the predetermined time period, the total number of unaligned write requests to a respective logical address region is determined to have exceeded a first threshold part-way through a one hour time period. As a result, the respective flag (e.g., one of flags 260, FIG. 2B) for that logical address region remains set both during the remainder of the one hour time period, and also through the next one hour time period (at which point it would be re-evaluated based on activity during that next one hour time period).

In some embodiments, the storage device, for each region of the plurality of regions in the logical address space of the host, stores (628) information (e.g., data gathered regarding the plurality of I/O requests) in a data structure (e.g., history table 224, FIG. 2A) to maintain a history of I/O request patterns in the region for the predetermined time period. For example, in some embodiments, the storage device stores information in region data structure 244-1 (FIG. 2B) to maintain a history of I/O request patterns in region 310-1 (FIG. 3) for the predetermined time period. In some embodiments, maintaining a history of I/O request patterns in the region for the predetermined time period includes gathering the historical data as I/O requests are received and/or processed. For example, in some embodiments, maintaining a history of I/O request patterns in region 310-1 (FIG. 3) includes gathering the historical data as read requests from and write requests to region 310-1 are received and/or processed. In some embodiments, the information is stored in a data structure stored on the storage device (e.g., storage device 120, FIG. 1). For example, in some embodiments, the history of I/O request patterns is maintained in a history table (e.g., history table 224, FIGS. 2A and 2B) stored on the storage device (e.g., in memory 206 of management module 121 of storage controller 124 of storage device 120, FIG. 1). In some embodiments, the storage device gathers data as I/O requests are processed and stores the history of I/O request patterns and/or determinations based on the history of I/O request patterns in a history table (e.g., history table 224, FIGS. 2A and 2B) stored on the storage device. In some embodiments, the history table includes one or more data structures.

In some embodiments, one or more operations performed to gather data and/or make determinations based on the data are performed at a host (e.g., computer system 110, FIG. 1), relevant information is transmitted from the host to a storage device (e.g., storage device 120, FIG. 1), and the history of I/O request patterns is maintained in a data structure on the storage device. In some embodiments, the information is stored in a data structure stored on the host (e.g., computer system 110, FIG. 1). For example, in some embodiments, the history of I/O request patterns is maintained in a history table stored on the host. In some embodiments, the host gathers data as I/O requests are processed and stores the history of I/O request patterns and/or determinations based on the history of I/O request patterns in a history table stored on the host. In some embodiments, the history table includes one or more data structures. In some embodiments, a history maintaining module (e.g., history maintaining module 222, FIG. 2A) is used to store, for each region of the plurality of regions in the logical address space of the host, information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period, as described above with respect to FIG. 2A.

In some embodiments, any of the methods described above are performed by a storage device, the storage device including (1) one or more processors, and (2) memory storing one or more programs, which when executed by the one or more processors cause the storage device to perform or control performance of any of the methods described herein.

In some embodiments, any of the methods described above are performed by a storage system comprising (1) a storage medium (e.g., comprising one or more non-volatile storage devices, such as flash memory devices) (2) one or more processors, and (3) memory storing one or more programs, which when executed by the one or more processors cause the storage system to perform or control performance of any of the methods described herein.

Semiconductor memory devices include volatile memory devices, such as dynamic random access memory (“DRAM”) or static random access memory (“SRAM”) devices, non-volatile memory devices, such as resistive random access memory (“ReRAM”), electrically erasable programmable read only memory (“EEPROM”), flash memory (which can also be considered a subset of EEPROM), ferroelectric random access memory (“FRAM”), and magnetoresistive random access memory (“MRAM”), and other semiconductor elements capable of storing information. Each type of memory device may have different configurations. For example, flash memory devices may be configured in a NAND or a NOR configuration.

The memory devices can be formed from passive and/or active elements, in any combinations. By way of non-limiting example, passive semiconductor memory elements include ReRAM device elements, which in some embodiments include a resistivity switching storage element, such as an anti-fuse, phase change material, etc., and optionally a steering element, such as a diode, etc. Further by way of non-limiting example, active semiconductor memory elements include EEPROM and flash memory device elements, which in some embodiments include elements containing a charge storage region, such as a floating gate, conductive nanoparticles, or a charge storage dielectric material.

Multiple memory elements may be configured so that they are connected in series or so that each element is individually accessible. By way of non-limiting example, flash memory devices in a NAND configuration (NAND memory) typically contain memory elements connected in series. A NAND memory array may be configured so that the array is composed of multiple strings of memory in which a string is composed of multiple memory elements sharing a single bit line and accessed as a group. Alternatively, memory elements may be configured so that each element is individually accessible (e.g., a NOR memory array). NAND and NOR memory configurations are exemplary, and memory elements may be otherwise configured.

The semiconductor memory elements located within and/or over a substrate may be arranged in two or three dimensions, such as a two dimensional memory structure or a three dimensional memory structure.

In a two dimensional memory structure, the semiconductor memory elements are arranged in a single plane or a single memory device level. Typically, in a two dimensional memory structure, memory elements are arranged in a plane (e.g., in an x-z direction plane) which extends substantially parallel to a major surface of a substrate that supports the memory elements. The substrate may be a wafer over or in which the layer of the memory elements are formed or it may be a carrier substrate which is attached to the memory elements after they are formed. As a non-limiting example, the substrate may include a semiconductor such as silicon.

The memory elements may be arranged in the single memory device level in an ordered array, such as in a plurality of rows and/or columns. However, the memory elements may be arrayed in non-regular or non-orthogonal configurations. The memory elements may each have two or more electrodes or contact lines, such as bit lines and word lines.

A three dimensional memory array is arranged so that memory elements occupy multiple planes or multiple memory device levels, thereby forming a structure in three dimensions (i.e., in the x, y and z directions, where the y direction is substantially perpendicular and the x and z directions are substantially parallel to the major surface of the substrate).

As a non-limiting example, a three dimensional memory structure may be vertically arranged as a stack of multiple two dimensional memory device levels. As another non-limiting example, a three dimensional memory array may be arranged as multiple vertical columns (e.g., columns extending substantially perpendicular to the major surface of the substrate, i.e., in the y direction) with each column having multiple memory elements in each column. The columns may be arranged in a two dimensional configuration (e.g., in an x-z plane), resulting in a three dimensional arrangement of memory elements with elements on multiple vertically stacked memory planes. Other configurations of memory elements in three dimensions can also constitute a three dimensional memory array.

By way of non-limiting example, in a three dimensional NAND memory array, the memory elements may be coupled together to form a NAND string within a single horizontal (e.g., x-z) memory device level. Alternatively, the memory elements may be coupled together to form a vertical NAND string that traverses across multiple horizontal memory device levels. Other three dimensional configurations can be envisioned wherein some NAND strings contain memory elements in a single memory level while other strings contain memory elements which span through multiple memory levels. Three dimensional memory arrays may also be designed in a NOR configuration and in a ReRAM configuration.

Typically, in a monolithic three dimensional memory array, one or more memory device levels are formed above a single substrate. Optionally, the monolithic three dimensional memory array may also have one or more memory layers at least partially within the single substrate. As a non-limiting example, the substrate may include a semiconductor such as silicon. In a monolithic three dimensional array, the layers constituting each memory device level of the array are typically formed on the layers of the underlying memory device levels of the array. However, layers of adjacent memory device levels of a monolithic three dimensional memory array may be shared or have intervening layers between memory device levels.

Then again, two dimensional arrays may be formed separately and then packaged together to form a non-monolithic memory device having multiple layers of memory. For example, non-monolithic stacked memories can be constructed by forming memory levels on separate substrates and then stacking the memory levels atop each other. The substrates may be thinned or removed from the memory device levels before stacking, but as the memory device levels are initially formed over separate substrates, the resulting memory arrays are not monolithic three dimensional memory arrays. Further, multiple two dimensional memory arrays or three dimensional memory arrays (monolithic or non-monolithic) may be formed on separate chips and then packaged together to form a stacked-chip memory device.

Associated circuitry is typically required for operation of the memory elements and for communication with the memory elements. As non-limiting examples, memory devices may have circuitry used for controlling and driving memory elements to accomplish functions such as programming and reading. This associated circuitry may be on the same substrate as the memory elements and/or on a separate substrate. For example, a controller for memory read-write operations may be located on a separate controller chip and/or on the same substrate as the memory elements.

The term “three-dimensional memory device” (or 3D memory device) is herein defined to mean a memory device having multiple memory layers or multiple levels (e.g., sometimes called multiple memory device levels) of memory elements, including any of the following: a memory device having a monolithic or non-monolithic 3D memory array, some non-limiting examples of which are described above; or two or more 2D and/or 3D memory devices, packaged together to form a stacked-chip memory device, some non-limiting examples of which are described above.

One of skill in the art will recognize that this invention is not limited to the two dimensional and three dimensional exemplary structures described but cover all relevant memory structures within the spirit and scope of the invention as described herein and as understood by one of skill in the art.

It will be understood that, although the terms “first,” “second,” etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first region could be termed a second region, and, similarly, a second region could be termed a first region, without changing the meaning of the description, so long as all occurrences of the “first region” are renamed consistently and all occurrences of the “second region” are renamed consistently. The first region and the second region are both regions, but they are not the same region.

The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the claims. As used in the description of the embodiments and the appended claims, the singular forms “a,” “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term “and/or” as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

As used herein, the term “if” may be construed to mean “when” or “upon” or “in response to determining” or “in accordance with a determination” or “in response to detecting,” that a stated condition precedent is true, depending on the context. Similarly, the phrase “if it is determined [that a stated condition precedent is true]” or “if [a stated condition precedent is true]” or “when [a stated condition precedent is true]” may be construed to mean “upon determining” or “in response to determining” or “in accordance with a determination” or “upon detecting” or “in response to detecting” that the stated condition precedent is true, depending on the context.

The foregoing description, for purpose of explanation, has been described with reference to specific embodiments. However, the illustrative discussions above are not intended to be exhaustive or to limit the claims to the precise forms disclosed. Many modifications and variations are possible in view of the above teachings. The embodiments were chosen and described in order to best explain principles of operation and practical applications, to thereby enable others skilled in the art. 

What is claimed is:
 1. A method, comprising: receiving, at a storage device, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host; and performing one or more operations for each region of the plurality of regions in the logical address space of the host, including: determining whether the region, comprising a respective region of the plurality of regions in the logical address space of the host, has a history of unaligned write requests to the region in the logical address space of the host during a predetermined time period, wherein unaligned write requests are write requests not aligned with predefined page boundaries; and in accordance with a determination that the region has a history of unaligned write requests to the region in the logical address space of the host during the predetermined time period: determining one or more sub-regions of a plurality of sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period; and caching, from a storage medium of the storage device to a cache of the storage device, data from the determined one or more sub-regions.
 2. The method of claim 1, wherein, caching data from the determined one or more sub-regions includes: in response to a subsequent write request to a respective sub-region of the determined one or more sub-regions, caching the respective sub-region.
 3. The method of claim 1, wherein, with respect to a region of the plurality of regions, determining whether the region has a history of unaligned write requests during the predetermined time period includes: tracking a total number of unaligned write requests to the region; and determining whether the total number of unaligned write requests to the region is greater than a first threshold.
 4. The method of claim 1, further comprising, with respect to a sub-region of the determined one or more sub-regions, subsequent to caching data from the sub-region: writing subsequent write requests to the sub-region to the cache; reading subsequent read requests from the sub-region from the cache; and writing contents of the cache to the storage medium of the storage device in a merged operation.
 5. The method of claim 1, further comprising, for each region of the plurality of regions in the logical address space, setting a flag to denote the determination of whether the region has a history of unaligned write requests during the predetermined time period.
 6. The method of claim 1, further comprising, for each region of the plurality of regions in the logical address space, storing information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period.
 7. The method of claim 1, wherein the predetermined time period is configurable.
 8. The method of claim 1, wherein the predetermined threshold number is configurable.
 9. The method of claim 1, wherein the storage device comprises one or more flash memory devices.
 10. The method of claim 1, wherein the storage device comprises one or more three-dimensional (3D) memory devices and circuitry associated with operation of memory elements in the one or more 3D memory devices.
 11. The method of claim 10, wherein the circuitry and one or more memory elements in a respective 3D memory device, of the one or more 3D memory devices, are on the same substrate.
 12. A storage device, comprising: one or more processors; and memory storing one or more programs, which when executed by the one or more processors cause the storage device to: receive, at the storage device, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host; and perform one or more operations for each region of the plurality of regions in the logical address space of the host, including: determining whether the region, comprising a respective region of the plurality of regions in the logical address space of the host, has a history of unaligned write requests to the region in the logical address space of the host during a predetermined time period, wherein unaligned write requests are write requests not aligned with predefined page boundaries; and in accordance with a determination that the region has a history of unaligned write requests to the region in the logical address space of the host during the predetermined time period: determining one or more sub-regions of a plurality of sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period; and caching, from a storage medium of the storage device to a cache of the storage device, data from the determined one or more sub-regions.
 13. The storage device of claim 12, wherein, caching data from the determined one or more sub-regions includes: in response to a subsequent write request to a respective sub-region of the determined one or more sub-regions, caching the respective sub-region.
 14. The storage device of claim 12, wherein, with respect to a region of the plurality of regions, determining whether the region has a history of unaligned write requests during the predetermined time period includes: tracking a total number of unaligned write requests to the region; and determining whether the total number of unaligned write requests to the region is greater than a first threshold.
 15. The storage device of claim 12, wherein the one or more programs, which when executed by the one or more processors, further cause the storage device to, with respect to a sub-region of the determined one or more sub-regions, subsequent to caching data from the sub-region: write subsequent write requests to the sub-region to the cache; read subsequent read requests from the sub-region from the cache; and write contents of the cache to the storage medium of the storage device in a merged operation.
 16. The storage device of claim 12, wherein the one or more programs, which when executed by the one or more processors, further cause the storage device to: for each region of the plurality of regions in the logical address space, store information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period.
 17. A storage system, comprising: a storage medium; one or more processors; and memory storing one or more programs, which when executed by the one or more processors cause the storage system to: receive, at a storage device, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host; and perform one or more operations for each region of the plurality of regions in the logical address space of the host, including: determining whether the region, comprising a respective region of the plurality of regions in the logical address space of the host, has a history of unaligned write requests to the region in the logical address space of the host during a predetermined time period, wherein unaligned write requests are write requests not aligned with predefined page boundaries; and in accordance with a determination that the region has a history of unaligned write requests to the region in the logical address space of the host during the predetermined time period: determining one or more sub-regions of a plurality of sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period; and caching, from a storage medium of the storage device to a cache of the storage device, data from the determined one or more sub-regions.
 18. A non-transitory computer readable storage medium, storing one or more programs configured for execution by one or more processors of a storage device, the one or more programs including instructions for: receiving, at the storage device, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host; and performing one or more operations for each region of the plurality of regions in the logical address space of the host, including: determining whether the region, comprising a respective region of the plurality of regions in the logical address space of the host, has a history of unaligned write requests to the region in the logical address space of the host during a predetermined time period, wherein unaligned write requests are write requests not aligned with predefined page boundaries; and in accordance with a determination that the region has a history of unaligned write requests to the region in the logical address space of the host during the predetermined time period: determining one or more sub-regions of a plurality of sub-regions within the region that are accessed more than a predetermined threshold number of times during the predetermined time period; and caching, from a storage medium of the storage device to a cache of the storage device, data from the determined one or more sub-regions.
 19. The non-transitory computer readable storage medium of claim 18, wherein, caching data from the determined one or more sub-regions includes: in response to a subsequent write request to a respective sub-region of the determined one or more sub-regions, caching the respective sub-region.
 20. The non-transitory computer readable storage medium of claim 18, wherein, with respect to a region of the plurality of regions, determining whether the region has a history of unaligned write requests during the predetermined time period includes: tracking a total number of unaligned write requests to the region; and determining whether the total number of unaligned write requests to the region is greater than a first threshold.
 21. The non-transitory computer readable storage medium of claim 18, wherein the one or more programs further include instructions for, with respect to a sub-region of the determined one or more sub-regions, subsequent to caching data from the sub-region: writing subsequent write requests to the sub-region to the cache; reading subsequent read requests from the sub-region from the cache; and writing contents of the cache to the storage medium of the storage device in a merged operation.
 22. The non-transitory computer readable storage medium of claim 18, wherein the one or more programs further include instructions for: for each region of the plurality of regions in the logical address space, storing information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period. 